package com.sds.thesis.util;

import java.util.HashMap;
import java.util.Map;


public class TypeUtil {
    private static final Map<String, String> typeMap = new HashMap<>();

    static {
        typeMap.put("int", "Integer");
        typeMap.put("float", "Double");
        typeMap.put("password", "String");
        typeMap.put("email", "String");
        typeMap.put("string", "String");
        typeMap.put("textarea", "String");
        typeMap.put("boolean", "Boolean");
        typeMap.put("richtext", "String");
        typeMap.put("date", "Date");
        typeMap.put("imgUrl", "String");
        typeMap.put("soundUrl", "String");
        typeMap.put("videoUrl", "String");
        typeMap.put("radio", "String");
        typeMap.put("enums", "List<String>");
        typeMap.put("enum", "String");
        typeMap.put("id", "String");
        typeMap.put("checked", "List<String>");
    }

    public static String getType(String key) {
        return typeMap.getOrDefault(key, "String");
    }

    public static String getType(String key, boolean hasMany) {
        String type = typeMap.getOrDefault(key, "String");
        if (hasMany) {
            type = "List<" + type + ">";
        }
        return type;
    }
}
